package pers.duorhs.grgbusstation.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.duorhs.grgbusstation.domain.StationInfo;
import pers.duorhs.grgbusstation.service.StationsService;

import java.util.List;

/**
 * @author Duorhs
 * @date 2022/7/26 10:03
 */
@RestController
@AllArgsConstructor
@Tag(name = "班车站点API")
@CrossOrigin
public class StationController {
    private final StationsService stationsService;

    @Operation(summary = "获取所有站点", description = "获取站点信息，用于构建地图标记")
    @PostMapping("station/all")
    public List<StationInfo> getAllStations() {
        return stationsService.list();
    }

    /**
     * 开发用接口 用于构建站点JSON 理论上仅需要使用一次
     * TODO DELETE
     */
    // @PostMapping("dev")
    public void DEBUG_CREATE_STATION_JSON() {
        stationsService.DEV_READ_EXCEL();
    }
}
